const mongoose = require("mongoose");
const schema = new mongoose.Schema({
  name: { type: String }, //名字
  time: { type: String }, //创建时间
  avatar: { type: String }, //头像图片
  title: { type: String }, //标题
  banner: { type: String }, //banner图片
  categories: [{ type: mongoose.SchemaTypes.ObjectId, ref: "categories" }], //英雄分类,将英雄和分类管理起来
  scores: { //分数
    difficult: { type: Number }, //难度
    skills: { type: Number }, //技能
    attack: { type: Number }, //攻击
    survive: { type: Number }, //生存
  },
  skills: [{ //技能
    icon: { type: String }, //图片
    name: { type: String }, //名称
    delay: { type: String }, //冷却时间
    cost: { type: String }, //消费
    description: { type: String }, //描述
    tips: { type: String } //提示
  }],
  goods: [{ type: mongoose.SchemaTypes.ObjectId, ref: "Good" }], //推荐装备
  goods2: [{ type: mongoose.SchemaTypes.ObjectId, ref: "Good" }], //推荐装备2
  usagesTips: { type: String }, //使用提示
  battleTips: { type: String }, //战斗提示
  partners: [{ hero: { type: mongoose.SchemaTypes.ObjectId, ref: "heros" } }] //搭档
  // parent: { type: mongoose.SchemaTypes.ObjectId, ref: "goods" }
})

module.exports = mongoose.model("Hero", schema, "heros")